package com.dingyuhang.controller;


import com.dingyuhang.bean.Reply;
import com.dingyuhang.bean.User;
import com.dingyuhang.service.ReplyService;
import com.dingyuhang.util.MyAnn;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import javax.servlet.http.HttpSession;


/**
 * 回复功能
 *
 *
 */
@Controller
public class ReplyController {
	
	@Autowired
	private ReplyService replyService;
	
	
	/**
	 * 回复贴子内容
	 * @param reply
	 * @param session
	 * @param ra
	 * @return
	 */

	@RequestMapping("/replying")
	public String replying2(Reply reply, HttpSession session, RedirectAttributes ra) {
	      User user = (User) session.getAttribute("LOGIN_USER");//获取登陆人信息，回复表中需要回复人id
	      reply.setUser(user); 
		replyService.replying(reply);
		return "redirect:my/topicRelpy?id="+reply.getTopic().getId(); //回复后需要在次查询当前帖子的内容及回复信息
	}

}
